﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using Interface_Tier;
using Transfer_Object_Tier;

namespace eSolution_HRMSS.Winforms.QuaTrinhLamViec
{
    public partial class FR_TamUngLuong : DevExpress.XtraEditors.XtraForm
    {
        IHRM_PROCESS_ADVANCEData _IHRM_PROCESS_ADVANCEData;
        ICommonCode _icommon;
        eSolution_HRMSS.HRMSS_Ultil util = new HRMSS_Ultil();
        Guid currentId;
        Guid new_id;
        bool isUpdate = false;
         public FR_TamUngLuong(bool _isUpdate)
        {
            InitializeComponent();
            isUpdate = _isUpdate;
        }

         public FR_TamUngLuong(bool _isUpdate, Guid _currentId)
        {
            InitializeComponent();
            isUpdate = _isUpdate;
            currentId = _currentId;
        }

        private void FR_TamUngLuong_Load(object sender, EventArgs e)
        {
            _IHRM_PROCESS_ADVANCEData = (IHRM_PROCESS_ADVANCEData)Activator.GetObject(typeof(IHRM_PROCESS_ADVANCEData), util.ChuoiPROCESS_ADVANCEData);
            _icommon = (ICommonCode)Activator.GetObject(typeof(ICommonCode), util.Chuoicommon);
        }
        private HRM_PROCESS_ADVANCE lay_thong_tin()
        {
            string lydotamung = txtlydotamung.Text;
            string nguoitamung = txtnguoitamung.Text;

            decimal sotientamung = calsotientamung.Value;

            DateTime ngaytamung = dtngaytamung.DateTime;

            HRM_PROCESS_ADVANCE salary = new HRM_PROCESS_ADVANCE();
            salary.Reason = lydotamung;
            salary.Person = nguoitamung;
            salary.Money = sotientamung;
            salary.Date = ngaytamung;
            return salary;
        }
        private void load_info()
        {
            DataTable dt = _IHRM_PROCESS_ADVANCEData.HRM_PROCESS_ADVANCE_Get(currentId).Tables[0];
              foreach (DataRow dr in dt.Rows)
              {
                  txtlydotamung.Text = dr["Reason"].ToString();
                  txtnguoitamung.Text = dr["Person"].ToString();
                  calsotientamung.Value = decimal.Parse(dr["Money"].ToString());
                  dtngaytamung.DateTime = DateTime.Parse(dr["Date"].ToString());
              }
        }
    }
}